using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using CristiPotlog.Controls;
using ICP_MS.Plugin.Tune.Properties;
using ZedGraph;

namespace ICP_MS.Plugin.Tune;

public class FormNewAutoTuneRunWizard : Form
{
	private NewAutoTuneExperiment experiment = null;

	private Thread threadUptake = null;

	private Thread threadTune = null;

	private bool pauseUptake = false;

	private string[] LimitType = new string[5] { "无", "最大", "最小", "大于", "小于" };

	public static bool IsOpen;

	private IContainer components = null;

	private Wizard wizard1;

	private WizardPage wizardWelcom;

	private WizardPage wizardSample;

	private WizardPage wizardFinish;

	private WizardPage wizardView1;

	private TreeView treeViewDetail1;

	private WizardPage wizardUptake;

	private System.Windows.Forms.Label lblSolution;

	private System.Windows.Forms.Label label2;

	private System.Windows.Forms.Label label1;

	private ProgressBar barUptake;

	private System.Windows.Forms.Label label3;

	private WizardPage wizardAcquisition;

	private System.Windows.Forms.Label label4;

	private Button btnContinue;

	private Button btnPause;

	private System.Windows.Forms.Label lblUptake;

	private Button btnResult;

	private Button btnLog;

	private System.Windows.Forms.Label txtResult;

	private PictureBox picError;

	private ListBox listBoxTune;

	private ZedGraphControl graphMass;

	public FormNewAutoTuneRunWizard()
	{
		InitializeComponent();
		wizard1.CancelText = Lang.Txt("Tune.Cancel");
		wizard1.OkText = "完成";
		wizard1.NextText = "下一步>>";
		wizard1.BackText = "<<上一步";
	}

	private void FormAutoTuneRunWizard_Load(object sender, EventArgs e)
	{
		base.StartPosition = FormStartPosition.CenterParent;
		Win32API.SetTopMost((Control)this);
		IsOpen = true;
		graphMass.GraphPane.Title.Text = Lang.Txt("Tune.TuningCurve");
		graphMass.GraphPane.XAxis.Title.Text = "";
		graphMass.GraphPane.YAxis.Title.Text = Lang.Txt("AddFormSpectrums.Intensity");
		graphMass.GraphPane.AddCurve("Intensity", new PointPairList(), Color.Blue, SymbolType.None);
		graphMass.IsShowPointValues = true;
	}

	private void FormAutoTuneRunWizard_FormClosed(object sender, FormClosedEventArgs e)
	{
		IsOpen = false;
	}

	private void wizard1_AfterSwitchPages(object sender, Wizard.AfterSwitchPagesEventArgs e)
	{
		WizardPage newPage = wizard1.Pages[e.NewIndex];
		switch (e.NewIndex)
		{
		case 0:
			break;
		case 1:
			ShowDetailView();
			break;
		case 2:
			ShowSolution();
			break;
		case 3:
			ShowUptake();
			break;
		case 4:
			experiment.EventTuneFinish += experiment_EventTuneFinish;
			experiment.EventTuneMsg += experiment_EventTuneMsg;
			experiment.EventPointMsg += experiment_PointEventMsg;
			ShowTune();
			wizard1.NextEnabled = false;
			wizard1.BackEnabled = false;
			break;
		case 5:
			ShowResults();
			wizard1.NextEnabled = false;
			wizard1.BackEnabled = false;
			break;
		}
	}

	private void experiment_PointEventMsg(object sender, PointEventMsg e)
	{
		Invoke((MethodInvoker)delegate
		{
			PointPair point = new PointPair(graphMass.GraphPane.CurveList[0].Points.Count, e.Intensity)
			{
				Tag = $"{e.X},{e.Y},{e.Z},{e.Intensity}"
			};
			graphMass.GraphPane.CurveList[0].AddPoint(point);
			graphMass.AxisChange();
			graphMass.Refresh();
		});
	}

	private void wizard1_BeforeSwitchPages(object sender, Wizard.BeforeSwitchPagesEventArgs e)
	{
		WizardPage oldPage = wizard1.Pages[e.OldIndex];
		switch (e.OldIndex)
		{
		case 0:
			break;
		case 1:
			break;
		case 2:
			break;
		case 3:
			if (threadUptake != null && threadUptake.IsAlive)
			{
				threadUptake.Abort();
				threadUptake = null;
			}
			break;
		case 4:
			experiment.EventTuneFinish += experiment_EventTuneFinish;
			experiment.EventTuneMsg += experiment_EventTuneMsg;
			break;
		}
	}

	private void wizard1_Cancel(object sender, CancelEventArgs e)
	{
		if (MessageBox.Show(Lang.Txt("Tune.Text15"), Lang.Txt("Tune.Text16"), MessageBoxButtons.YesNo) == DialogResult.No)
		{
			e.Cancel = true;
		}
		else if (threadUptake != null && threadUptake.IsAlive)
		{
			threadUptake.Abort();
			threadUptake = null;
		}
		else if (experiment != null && experiment.isTuning)
		{
			experiment.StopTune();
		}
	}

	private void wizard1_Finish(object sender, EventArgs e)
	{
		if (!experiment.TuneSucceed)
		{
			return;
		}
		string time = DateTime.Now.ToString();
		InstrumentConfig config = new InstrumentConfig();
		config.Description = "AutoTune:" + experiment.Name;
		config.Time = time;
		config.Used = false;
		config.User = Environment.UserName;
		if (DataBase.Instance.SaveInstrumentConfig(config))
		{
			X2Lens lens = LensManager.x2lens.Clone();
			lens.name = time;
			Platform plat = PlatManager.plat.Clone();
			plat.name = time;
			PlasmaPara plasma = PlasmaManager.plasma.Clone();
			plasma.Name = time;
			RFS rfs = RFManager.rfs.Clone();
			rfs.name = time;
			if (!DataBase.Instance.SaveX2Lens(lens) || !DataBase.Instance.SavePlatform(plat) || !DataBase.Instance.SavePlasma(plasma) || !DataBase.Instance.SaveRFS(rfs))
			{
				MessageBox.Show("保存调谐参数失败!");
			}
		}
		else
		{
			MessageBox.Show("保存配置失败!");
		}
	}

	private void ShowDetailView()
	{
		experiment = NewAutoTuneExperiment.LoadConfig("NewAutoTune");
		if (experiment != null)
		{
			TreeView tree = treeViewDetail1;
			tree.Nodes.Clear();
			if (experiment == null)
			{
				return;
			}
			{
				foreach (NewAutoTuneExperiment.TuneStage stage in experiment.Stages)
				{
					if (!stage.Used)
					{
						continue;
					}
					TreeNode node = tree.Nodes.Add($"Stage: {stage.StageName};Iterations: {stage.Iterations};Sweeps: {stage.Sweeps}");
					TreeNode nodeP = node.Nodes.Add(Lang.Txt("Tune.Conditions"));
					foreach (NewAutoTuneExperiment.ParamConditon para in stage.Params.Where((NewAutoTuneExperiment.ParamConditon p) => p.Type != 0))
					{
						nodeP.Nodes.Add(para.Symbol + " " + LimitType[para.Type] + " " + para.Limit);
					}
					TreeNode nodeD = node.Nodes.Add(Lang.Txt("Tune.Control"));
					foreach (NewAutoTuneExperiment.DeviceCondition device in stage.Devices.Where((NewAutoTuneExperiment.DeviceCondition dev) => dev.Used))
					{
						nodeD.Nodes.Add($"{device.Device}-[{device.MinValue:0.0}:{device.DefaultValue:0.0}:{device.MaxValue:0.0}:{device.Step:0.0}]");
					}
				}
				return;
			}
		}
		MessageBox.Show("加载自动调谐配置失败！");
	}

	private void ShowSolution()
	{
		lblSolution.Text = experiment.Solution;
	}

	private void ShowUptake()
	{
		pauseUptake = false;
		btnPause.Enabled = true;
		btnContinue.Enabled = false;
		int tickCount = 40;
		threadUptake = new Thread((ThreadStart)delegate
		{
			while (tickCount > 0)
			{
				if (!pauseUptake)
				{
					tickCount--;
				}
				Invoke((MethodInvoker)delegate
				{
					barUptake.Value = tickCount;
					lblUptake.Text = $"{tickCount} s";
				});
				Thread.Sleep(1000);
			}
			wizard1.Next();
		});
		threadUptake.Start();
	}

	private void btnPause_Click(object sender, EventArgs e)
	{
		pauseUptake = true;
		btnContinue.Enabled = true;
		btnPause.Enabled = false;
	}

	private void btnContinue_Click(object sender, EventArgs e)
	{
		pauseUptake = false;
		btnPause.Enabled = true;
		btnContinue.Enabled = false;
	}

	private void ShowTune()
	{
		experiment.StartTune();
	}

	private void experiment_EventTuneFinish(object sender, EventArgs e)
	{
		Invoke((MethodInvoker)delegate
		{
			wizard1.Next();
		});
	}

	private void experiment_EventTuneMsg(object sender, MsgEventArgs e)
	{
		Invoke((MethodInvoker)delegate
		{
			if (e.Message == "1")
			{
				graphMass.GraphPane.CurveList[0].Clear();
				graphMass.GraphPane.Title.Text = "炬管位置：垂直位置、水平位置";
			}
			else if (e.Message == "2")
			{
				graphMass.GraphPane.CurveList[0].Clear();
				graphMass.GraphPane.Title.Text = "等离子体：功率、载气";
			}
			else if (e.Message == "3.0")
			{
				graphMass.GraphPane.CurveList[0].Clear();
				graphMass.GraphPane.Title.Text = "透镜组1：提取、L1、L2";
			}
			else if (e.Message == "3.1")
			{
				graphMass.GraphPane.CurveList[0].Clear();
				graphMass.GraphPane.Title.Text = "透镜组1：L3";
			}
			else if (e.Message == "4.0")
			{
				graphMass.GraphPane.CurveList[0].Clear();
				graphMass.GraphPane.Title.Text = "透镜组2：聚焦、D1、D2";
			}
			else if (e.Message == "4.1")
			{
				graphMass.GraphPane.CurveList[0].Clear();
				graphMass.GraphPane.Title.Text = "透镜组2：DA";
			}
			else if (e.Message == "4.2")
			{
				graphMass.GraphPane.CurveList[0].Clear();
				graphMass.GraphPane.Title.Text = "透镜组2：QE";
			}
			else
			{
				listBoxTune.Items.Add(e.Message);
				listBoxTune.SelectedIndex = listBoxTune.Items.Count - 1;
			}
		});
	}

	private void ShowResults()
	{
		if (!experiment.TuneSucceed)
		{
			picError.Visible = true;
			txtResult.ForeColor = Color.Red;
			txtResult.Text = Lang.Txt("Tune.Text44");
			return;
		}
		picError.Visible = false;
		txtResult.ForeColor = Color.Black;
		StringBuilder sb = new StringBuilder();
		foreach (NewAutoTuneExperiment.TuneStage stage in experiment.Stages)
		{
			if (!stage.Used)
			{
				continue;
			}
			sb.AppendLine(stage.StageName);
			sb.AppendLine("    Devices:");
			foreach (NewAutoTuneExperiment.DeviceCondition device in stage.Devices.Where((NewAutoTuneExperiment.DeviceCondition dev) => dev.Used))
			{
				sb.AppendLine($"      {device.Device}:{device.BestValue:0.00}");
			}
			sb.AppendLine();
			sb.AppendLine("    Results:");
			foreach (NewAutoTuneExperiment.ParamConditon para in stage.Params.Where((NewAutoTuneExperiment.ParamConditon p) => p.Type != 0))
			{
				sb.AppendLine($"       {para.Symbol}:{para.BestResult:0.000}");
			}
		}
		txtResult.Text = sb.ToString();
	}

	private void btnLog_Click(object sender, EventArgs e)
	{
		string tmpName = Path.GetTempFileName();
		using (StreamWriter sw = new StreamWriter(tmpName))
		{
			StringBuilder sb = new StringBuilder();
			foreach (object item in listBoxTune.Items)
			{
				sb.AppendLine(item.ToString());
			}
			sw.WriteLine(sb.ToString());
		}
		Process.Start("notepad.exe", tmpName);
	}

	private void btnResult_Click(object sender, EventArgs e)
	{
		string tmpName = Path.GetTempFileName();
		using (StreamWriter sw = new StreamWriter(tmpName))
		{
			sw.Write(txtResult.Text);
		}
		Process.Start("notepad.exe", tmpName);
	}

	private void FormNewAutoTuneRunWizard_FormClosing(object sender, FormClosingEventArgs e)
	{
		experiment.EventPointMsg -= experiment_PointEventMsg;
		experiment.EventTuneFinish -= experiment_EventTuneFinish;
		experiment.EventTuneMsg -= experiment_EventTuneMsg;
	}

	private string graphMass_CursorValueEvent(ZedGraphControl sender, GraphPane pane, Point mousePt)
	{
		if (sender != null)
		{
			double x = 0.0;
			double y = 0.0;
			string xTitle = string.Empty;
			string yTtile = string.Empty;
			string tag = string.Empty;
			string xVlaue = string.Empty;
			string z = string.Empty;
			try
			{
				sender.GraphPane.FindNearestPoint(mousePt, out var nearstCurve, out var i);
				if (nearstCurve != null && nearstCurve.Points.Count > i && nearstCurve.Points[i] != null)
				{
					z = nearstCurve.Points[i].Tag.ToString();
					y = nearstCurve.Points[i].Y;
					xTitle = sender.GraphPane.XAxis.Title.Text;
					yTtile = sender.GraphPane.YAxisList[nearstCurve.YAxisIndex].Title.Text;
					tag = nearstCurve.Tag.ToString();
				}
			}
			catch (Exception)
			{
			}
			return z + "  Y-" + yTtile + ": " + y;
		}
		return string.Empty;
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.components = new System.ComponentModel.Container();
		this.wizard1 = new CristiPotlog.Controls.Wizard();
		this.wizardWelcom = new CristiPotlog.Controls.WizardPage();
		this.wizardFinish = new CristiPotlog.Controls.WizardPage();
		this.txtResult = new System.Windows.Forms.Label();
		this.picError = new System.Windows.Forms.PictureBox();
		this.btnResult = new System.Windows.Forms.Button();
		this.btnLog = new System.Windows.Forms.Button();
		this.wizardAcquisition = new CristiPotlog.Controls.WizardPage();
		this.listBoxTune = new System.Windows.Forms.ListBox();
		this.label4 = new System.Windows.Forms.Label();
		this.wizardUptake = new CristiPotlog.Controls.WizardPage();
		this.btnContinue = new System.Windows.Forms.Button();
		this.btnPause = new System.Windows.Forms.Button();
		this.lblUptake = new System.Windows.Forms.Label();
		this.barUptake = new System.Windows.Forms.ProgressBar();
		this.label3 = new System.Windows.Forms.Label();
		this.wizardSample = new CristiPotlog.Controls.WizardPage();
		this.lblSolution = new System.Windows.Forms.Label();
		this.label2 = new System.Windows.Forms.Label();
		this.label1 = new System.Windows.Forms.Label();
		this.wizardView1 = new CristiPotlog.Controls.WizardPage();
		this.treeViewDetail1 = new System.Windows.Forms.TreeView();
		this.graphMass = new ZedGraph.ZedGraphControl();
		this.wizard1.SuspendLayout();
		this.wizardFinish.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.picError).BeginInit();
		this.wizardAcquisition.SuspendLayout();
		this.wizardUptake.SuspendLayout();
		this.wizardSample.SuspendLayout();
		this.wizardView1.SuspendLayout();
		base.SuspendLayout();
		this.wizard1.AutoSize = true;
		this.wizard1.Controls.Add(this.wizardAcquisition);
		this.wizard1.Controls.Add(this.wizardUptake);
		this.wizard1.Controls.Add(this.wizardSample);
		this.wizard1.Controls.Add(this.wizardView1);
		this.wizard1.Controls.Add(this.wizardWelcom);
		this.wizard1.Controls.Add(this.wizardFinish);
		this.wizard1.HeaderImage = ICP_MS.Plugin.Tune.Properties.Resources.wizardHeader;
		this.wizard1.Location = new System.Drawing.Point(0, 0);
		this.wizard1.Margin = new System.Windows.Forms.Padding(4);
		this.wizard1.Name = "wizard1";
		this.wizard1.Pages.AddRange(new CristiPotlog.Controls.WizardPage[6] { this.wizardWelcom, this.wizardView1, this.wizardSample, this.wizardUptake, this.wizardAcquisition, this.wizardFinish });
		this.wizard1.Size = new System.Drawing.Size(905, 464);
		this.wizard1.TabIndex = 0;
		this.wizard1.WelcomeImage = ICP_MS.Plugin.Tune.Properties.Resources.wizardWelcom;
		this.wizard1.BeforeSwitchPages += new CristiPotlog.Controls.Wizard.BeforeSwitchPagesEventHandler(wizard1_BeforeSwitchPages);
		this.wizard1.AfterSwitchPages += new CristiPotlog.Controls.Wizard.AfterSwitchPagesEventHandler(wizard1_AfterSwitchPages);
		this.wizard1.Cancel += new System.ComponentModel.CancelEventHandler(wizard1_Cancel);
		this.wizard1.Finish += new System.EventHandler(wizard1_Finish);
		this.wizardWelcom.Description = "使用这个向导逐步完成自动调谐";
		this.wizardWelcom.Location = new System.Drawing.Point(0, 0);
		this.wizardWelcom.Margin = new System.Windows.Forms.Padding(4);
		this.wizardWelcom.Name = "wizardWelcom";
		this.wizardWelcom.Size = new System.Drawing.Size(688, 416);
		this.wizardWelcom.Style = CristiPotlog.Controls.WizardPageStyle.Welcome;
		this.wizardWelcom.TabIndex = 10;
		this.wizardWelcom.Title = "自动调谐配置";
		this.wizardFinish.Controls.Add(this.txtResult);
		this.wizardFinish.Controls.Add(this.picError);
		this.wizardFinish.Controls.Add(this.btnResult);
		this.wizardFinish.Controls.Add(this.btnLog);
		this.wizardFinish.Description = "点击 OK 完成设置";
		this.wizardFinish.Location = new System.Drawing.Point(0, 0);
		this.wizardFinish.Margin = new System.Windows.Forms.Padding(4);
		this.wizardFinish.Name = "wizardFinish";
		this.wizardFinish.Size = new System.Drawing.Size(688, 416);
		this.wizardFinish.Style = CristiPotlog.Controls.WizardPageStyle.Finish;
		this.wizardFinish.TabIndex = 15;
		this.wizardFinish.Title = "完成";
		this.txtResult.Location = new System.Drawing.Point(240, 118);
		this.txtResult.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.txtResult.Name = "txtResult";
		this.txtResult.Size = new System.Drawing.Size(444, 199);
		this.txtResult.TabIndex = 4;
		this.picError.BackColor = System.Drawing.Color.Transparent;
		this.picError.Image = ICP_MS.Plugin.Tune.Properties.Resources.Bug;
		this.picError.Location = new System.Drawing.Point(243, 85);
		this.picError.Margin = new System.Windows.Forms.Padding(4);
		this.picError.Name = "picError";
		this.picError.Size = new System.Drawing.Size(41, 29);
		this.picError.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
		this.picError.TabIndex = 3;
		this.picError.TabStop = false;
		this.picError.Visible = false;
		this.btnResult.Location = new System.Drawing.Point(381, 330);
		this.btnResult.Margin = new System.Windows.Forms.Padding(4);
		this.btnResult.Name = "btnResult";
		this.btnResult.Size = new System.Drawing.Size(100, 29);
		this.btnResult.TabIndex = 2;
		this.btnResult.Text = "结果";
		this.btnResult.UseVisualStyleBackColor = true;
		this.btnResult.Click += new System.EventHandler(btnResult_Click);
		this.btnLog.Location = new System.Drawing.Point(259, 330);
		this.btnLog.Margin = new System.Windows.Forms.Padding(4);
		this.btnLog.Name = "btnLog";
		this.btnLog.Size = new System.Drawing.Size(100, 29);
		this.btnLog.TabIndex = 1;
		this.btnLog.Text = "日志";
		this.btnLog.UseVisualStyleBackColor = true;
		this.btnLog.Click += new System.EventHandler(btnLog_Click);
		this.wizardAcquisition.Controls.Add(this.graphMass);
		this.wizardAcquisition.Controls.Add(this.listBoxTune);
		this.wizardAcquisition.Controls.Add(this.label4);
		this.wizardAcquisition.Description = "采集数据并调谐硬件";
		this.wizardAcquisition.Location = new System.Drawing.Point(0, 0);
		this.wizardAcquisition.Margin = new System.Windows.Forms.Padding(4);
		this.wizardAcquisition.Name = "wizardAcquisition";
		this.wizardAcquisition.Size = new System.Drawing.Size(905, 416);
		this.wizardAcquisition.TabIndex = 23;
		this.wizardAcquisition.Title = "开始调谐";
		this.listBoxTune.FormattingEnabled = true;
		this.listBoxTune.ItemHeight = 15;
		this.listBoxTune.Location = new System.Drawing.Point(4, 92);
		this.listBoxTune.Margin = new System.Windows.Forms.Padding(4);
		this.listBoxTune.Name = "listBoxTune";
		this.listBoxTune.Size = new System.Drawing.Size(281, 304);
		this.listBoxTune.TabIndex = 1;
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(4, 67);
		this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(82, 15);
		this.label4.TabIndex = 0;
		this.label4.Text = "调谐状态：";
		this.wizardUptake.Controls.Add(this.btnContinue);
		this.wizardUptake.Controls.Add(this.btnPause);
		this.wizardUptake.Controls.Add(this.lblUptake);
		this.wizardUptake.Controls.Add(this.barUptake);
		this.wizardUptake.Controls.Add(this.label3);
		this.wizardUptake.Location = new System.Drawing.Point(0, 0);
		this.wizardUptake.Margin = new System.Windows.Forms.Padding(4);
		this.wizardUptake.Name = "wizardUptake";
		this.wizardUptake.Size = new System.Drawing.Size(905, 416);
		this.wizardUptake.TabIndex = 22;
		this.wizardUptake.Title = "提升溶液";
		this.btnContinue.Location = new System.Drawing.Point(347, 254);
		this.btnContinue.Margin = new System.Windows.Forms.Padding(4);
		this.btnContinue.Name = "btnContinue";
		this.btnContinue.Size = new System.Drawing.Size(100, 29);
		this.btnContinue.TabIndex = 4;
		this.btnContinue.Text = "继续";
		this.btnContinue.UseVisualStyleBackColor = true;
		this.btnContinue.Click += new System.EventHandler(btnContinue_Click);
		this.btnPause.Location = new System.Drawing.Point(197, 254);
		this.btnPause.Margin = new System.Windows.Forms.Padding(4);
		this.btnPause.Name = "btnPause";
		this.btnPause.Size = new System.Drawing.Size(100, 29);
		this.btnPause.TabIndex = 3;
		this.btnPause.Text = "暂停";
		this.btnPause.UseVisualStyleBackColor = true;
		this.btnPause.Click += new System.EventHandler(btnPause_Click);
		this.lblUptake.AutoSize = true;
		this.lblUptake.Location = new System.Drawing.Point(303, 216);
		this.lblUptake.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.lblUptake.Name = "lblUptake";
		this.lblUptake.Size = new System.Drawing.Size(39, 15);
		this.lblUptake.TabIndex = 2;
		this.lblUptake.Text = "40 s";
		this.barUptake.Location = new System.Drawing.Point(92, 169);
		this.barUptake.Margin = new System.Windows.Forms.Padding(4);
		this.barUptake.Maximum = 40;
		this.barUptake.Name = "barUptake";
		this.barUptake.Size = new System.Drawing.Size(496, 29);
		this.barUptake.Step = 1;
		this.barUptake.TabIndex = 1;
		this.label3.AutoSize = true;
		this.label3.Location = new System.Drawing.Point(52, 124);
		this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(353, 15);
		this.label3.TabIndex = 0;
		this.label3.Text = "提升溶液，点击 下一步 跳过此步骤，直接开始调谐";
		this.wizardSample.Controls.Add(this.lblSolution);
		this.wizardSample.Controls.Add(this.label2);
		this.wizardSample.Controls.Add(this.label1);
		this.wizardSample.Description = "准备样品，进样";
		this.wizardSample.Location = new System.Drawing.Point(0, 0);
		this.wizardSample.Margin = new System.Windows.Forms.Padding(4);
		this.wizardSample.Name = "wizardSample";
		this.wizardSample.Size = new System.Drawing.Size(905, 416);
		this.wizardSample.TabIndex = 14;
		this.wizardSample.Title = "进样";
		this.lblSolution.AutoSize = true;
		this.lblSolution.Location = new System.Drawing.Point(111, 205);
		this.lblSolution.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.lblSolution.Name = "lblSolution";
		this.lblSolution.Size = new System.Drawing.Size(0, 15);
		this.lblSolution.TabIndex = 2;
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(57, 170);
		this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(82, 15);
		this.label2.TabIndex = 1;
		this.label2.Text = "溶液要求：";
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(57, 118);
		this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(308, 15);
		this.label1.TabIndex = 0;
		this.label1.Text = "将进样管放入溶液后，点击 下一步 提升溶液";
		this.wizardView1.Controls.Add(this.treeViewDetail1);
		this.wizardView1.Description = "查看自动调谐的具体步骤和参数条件";
		this.wizardView1.Location = new System.Drawing.Point(0, 0);
		this.wizardView1.Margin = new System.Windows.Forms.Padding(4);
		this.wizardView1.Name = "wizardView1";
		this.wizardView1.Size = new System.Drawing.Size(905, 416);
		this.wizardView1.TabIndex = 16;
		this.wizardView1.Title = "查看调谐步骤";
		this.treeViewDetail1.Location = new System.Drawing.Point(4, 84);
		this.treeViewDetail1.Margin = new System.Windows.Forms.Padding(4);
		this.treeViewDetail1.Name = "treeViewDetail1";
		this.treeViewDetail1.Size = new System.Drawing.Size(888, 289);
		this.treeViewDetail1.TabIndex = 0;
		this.graphMass.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
		this.graphMass.Location = new System.Drawing.Point(294, 92);
		this.graphMass.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
		this.graphMass.Name = "graphMass";
		this.graphMass.ScrollGrace = 0.0;
		this.graphMass.ScrollMaxX = 0.0;
		this.graphMass.ScrollMaxY = 0.0;
		this.graphMass.ScrollMaxY2 = 0.0;
		this.graphMass.ScrollMinX = 0.0;
		this.graphMass.ScrollMinY = 0.0;
		this.graphMass.ScrollMinY2 = 0.0;
		this.graphMass.Size = new System.Drawing.Size(591, 304);
		this.graphMass.TabIndex = 3;
		this.graphMass.CursorValueEvent += new ZedGraph.ZedGraphControl.CursorValueHandler(graphMass_CursorValueEvent);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
		base.ClientSize = new System.Drawing.Size(905, 464);
		base.Controls.Add(this.wizard1);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
		base.Margin = new System.Windows.Forms.Padding(4);
		base.MaximizeBox = false;
		base.MinimizeBox = false;
		base.Name = "FormNewAutoTuneRunWizard";
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
		this.Text = "自动调谐";
		base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(FormNewAutoTuneRunWizard_FormClosing);
		base.FormClosed += new System.Windows.Forms.FormClosedEventHandler(FormAutoTuneRunWizard_FormClosed);
		base.Load += new System.EventHandler(FormAutoTuneRunWizard_Load);
		this.wizard1.ResumeLayout(false);
		this.wizardFinish.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.picError).EndInit();
		this.wizardAcquisition.ResumeLayout(false);
		this.wizardAcquisition.PerformLayout();
		this.wizardUptake.ResumeLayout(false);
		this.wizardUptake.PerformLayout();
		this.wizardSample.ResumeLayout(false);
		this.wizardSample.PerformLayout();
		this.wizardView1.ResumeLayout(false);
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
